package routes

import (
	"fmt"
	"hft/global"
	"hft/tools/weixin/push"
	"hft/tools/ws/single_ws"
	"hft/tools/ws/total_ws"
	"time"

	middleware "hft/Http/Middleware"

	controller "hft/Http/Controller"

	"github.com/gin-gonic/gin"

	"hft/Http/Controller/account"
	"hft/Http/Controller/broker"
	chat1 "hft/Http/Controller/chat"
	"hft/Http/Controller/common_phrase"
	"hft/Http/Controller/country_setting"
	"hft/Http/Controller/dir"
	"hft/Http/Controller/file"
	"hft/Http/Controller/friendly_link"
	front "hft/Http/Controller/front"
	"hft/Http/Controller/front/amap"
	"hft/Http/Controller/front/app"
	"hft/Http/Controller/front/chat"
	"hft/Http/Controller/front/help_center"
	"hft/Http/Controller/front/pc"
	wx_controller "hft/Http/Controller/front/wx"
	"hft/Http/Controller/home_swiper"
	controller_join "hft/Http/Controller/join"
	"hft/Http/Controller/login"
	"hft/Http/Controller/loupan"
	"hft/Http/Controller/new_clue"
	"hft/Http/Controller/operate"
	"hft/Http/Controller/phone"
	"hft/Http/Controller/region"
	"hft/Http/Controller/site"
	admin_system "hft/Http/Controller/system"
	"hft/Http/Controller/user"
	"hft/Http/Controller/wechat"
)

func InitRoutes() {
	gin.ForceConsoleColor() //强制颜色
	Router := gin.Default()
	// 健康监测
	// Router.GET("/test", func(ctx *gin.Context) {
	// 	ctx.String(200, "成功!!!111")
	// })
	WeiXinGroup := Router.Group("/wx")
	{
		WeiXinGroup.POST("", push.PushWx.TotalInterface) //总接口
		WeiXinGroup.GET("", push.PushWx.Valid)           //校验
	}
	// 长连接
	WSGroup := Router.Group("/wss")
	{
		WSGroup.GET("/total", total_ws.MessageNotify) //总链接 用于收发统一信息
	}
	// 经纪人端口
	BrokerGroup := Router.Group("/broker")
	{

	}
	{
		BrokerNoAuth := BrokerGroup.Group("")
		{
			// 无需验证
			// 经纪人登录
			BrokerNoAuth.POST("/login")
			// 登出
			BrokerNoAuth.POST("/logout")
		}
		BrokerAuth := BrokerGroup.Group("")
		{
			// 这里插入验证的中间件
			BrokerAuth.Use(middleware.JWTAuth())
		}

	}
	// 400接受推送
	PhoneGroup := Router.Group("/phone")
	{
		CallLogRoute := PhoneGroup.Group("/call_log")
		{
			CallLogRoute.POST("/record", phone.CallLogController.GetCallLog)
		}
	}
	// 前端路由
	FrontGroup := Router.Group(global.OC_CONFIG.Front.PreFix)
	{
		// FrontGroup.Use(middleware.AllCors())
		// FrontGroup.Use(middleware.Zap())
		FrontGroup.Use(middleware.GetIpRegion())
	}
	{
		WxConfigRoute := FrontGroup.Group("/wx_config")
		{
			WxConfigRoute.GET("/conf", wx_controller.WxConfigController.GetWxConfig)
		}
		WebsocketRoute := FrontGroup.Group("/chat")
		{
			WebsocketRoute.GET("", single_ws.WsHandler)
		}

		SiteRoute := FrontGroup.Group("/site")
		{
			SiteRoute.GET("/all", front.SiteController.GetAllSite) //获取所有站点
		}
		RegionRoute := FrontGroup.Group("/region")
		{
			RegionRoute.GET("/list", front.RegionController.FindRegion) //获取区域
		}
		ClueRoute := FrontGroup.Group("/clue")
		{
			ClueRoute.POST("", new_clue.ClueController.Add)                  //留线索
			ClueRoute.POST("/chat_login", new_clue.ClueController.ChatLogin) //微聊登录
			ClueRoute.POST("/send", new_clue.ClueController.Send)            //发送验证码
			ClueRoute.POST("/valid", new_clue.ClueController.Valid)          //验证客户
		}
		AppFrontRoute := FrontGroup.Group("/app")
		{
			AppFrontRoute.GET("/join_conf", app.ApplicationController.GetProvinceAndCity)        //获取加盟配置
			AppFrontRoute.GET("/join_assist", app.ApplicationController.GetAssistAndPrivateBody) //获取加盟配置
			AppFrontRoute.POST("/join_us", app.ApplicationController.JoinUs)                     //加盟
			AppFrontRoute.GET("/index", app.ApplicationController.Index)                         //获取移动端首页消息
			AppFrontRoute.GET("/trans_sid", app.ApplicationController.TransSiteID)               //换取sid
			AppFrontRoute.GET("/bottom", app.BaseController.GetBottom)                           //获取底部
		}
		PCFrontRoute := FrontGroup.Group("/pc")
		{
			PCFrontRoute.GET("/index", pc.IndexController.GetIndex) //获取pc端首页信息
		}
		IndexRoute := FrontGroup.Group("/index")
		{
			IndexRoute.GET("", front.IndexController.GetIndex)                      //获取首页
			IndexRoute.GET("/seo", front.IndexController.SEOList)                   //seo
			IndexRoute.GET("/check_status", front.IndexController.CheckLoginStatus) //检查登录状态
		}
		FrontLouPanRoute := FrontGroup.Group("/loupan")
		{
			FrontLouPanRoute.GET("", front.LouPanController.GetLouPanList)               //获取楼盘
			FrontLouPanRoute.GET("/info", front.LouPanController.GetLouPanInfo)          //获取楼盘信息
			FrontLouPanRoute.GET("/swipe", front.LouPanController.GetSwipeList)          //获取楼盘相册
			FrontLouPanRoute.POST("/around_lou", front.LouPanController.AroundLou)       //楼盘周边
			FrontLouPanRoute.POST("/room_list", front.LouPanController.GetRoomList)      //获取户型一览
			FrontLouPanRoute.GET("/room_info", front.LouPanController.GetRoomInfo)       //获取户型详情
			FrontLouPanRoute.GET("/guess", front.LouPanController.Guess)                 //获取猜你喜欢
			FrontLouPanRoute.GET("/room_swipe", front.LouPanController.GetRoomSwipeList) //获取户型相册
			FrontLouPanRoute.GET("/lng_lat", front.LouPanController.GetLngLat)           //获取经纬度
			FrontLouPanRoute.GET("/call", front.LouPanController.GetPhoneCall)           //获取400
			FrontLouPanRoute.GET("/gangao", front.LouPanController.GetGangAo)            //获取400
		}
		MapRoute := FrontGroup.Group("/map")
		{
			MapRoute.GET("/searchV2", controller.MapController.SearchV2)
			MapRoute.GET("/tips", controller.MapController.InputTips)
			MapRoute.GET("/around", controller.MapController.SearchAround)
		}
		FrontArcRoute := FrontGroup.Group("/article")
		{
			FrontArcRoute.GET("/list", front.ArcController.GetArc)     //获取文章列表
			FrontArcRoute.GET("/info", front.ArcController.GetArcInfo) //获取文章详情
		}
		FrontActiveRoute := FrontGroup.Group("/active")
		{
			FrontActiveRoute.GET("/list", front.ActiveController.GetActiveList) //获取动态列表
			FrontActiveRoute.GET("/info", front.ActiveController.GetActiveInfo) //获取动态列表
		}
		FrontAdviseRoute := FrontGroup.Group("/advise")
		{
			FrontAdviseRoute.POST("/add", controller.AdviseController.Add)   //添加宝贵意见
			FrontAdviseRoute.POST("/list", controller.AdviseController.List) //意见列表
		}
		HelpRoute := FrontGroup.Group("/help")
		{
			HelpRoute.GET("/list", help_center.HelpCenterController.List)
			HelpRoute.GET("/info", help_center.HelpCenterController.Info)
		}
		AmapRoute := FrontGroup.Group("/map")
		{
			AmapRoute.GET("/search_around", amap.AmapController.SearchAround) //周边搜索
			AmapRoute.GET("/keywords", amap.AmapController.KeyWordSearch)     //关键字搜索
			AmapRoute.GET("/ip", amap.AmapController.GetIp)                   //IP搜索
			AmapRoute.GET("/ipv2", amap.AmapController.GetIpV2)               //IP搜索
		}
		ChatRoute := FrontGroup.Group("/chat")
		{
			ChatRoute.GET("/lou_info", chat.ChatController.GetLouPanInfo) //获取楼盘信息
			ChatRoute.POST("/leave_chat", chat1.ChatController.LeaveChat) //留线索
			ChatRoute.POST("/upload", chat1.ChatController.UploadFile)    //上传文件11111
		}
	}
	// 后端的路由
	BackGroup := Router.Group(global.OC_CONFIG.System.Prefix)
	{
		// 注册路由中间件
		BackGroup.Use(middleware.Zap())
	}
	{
		// 公共路由 (无需jwt验证)
		BaseRoutes := BackGroup.Group("")
		{
			BaseRoutes.GET("/get_region", region.RegionController.GetRegion) //获取区域

			BaseRoutes.GET("/region_list", region.RegionController.GetRegionList) //获取编辑好的区域列表
			BaseRoutes.POST("/:type/login", login.LoginController.Login)          //登录
			BaseRoutes.POST("/logout", login.LoginController.LogOut)              //登出

			BaseRoutes.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute)).POST("/send", login.LoginController.SendCode) //发送验证码
			BaseRoutes.POST("/valid", login.LoginController.ValidCode)                                                         //验证手机
		}
		// auth验证
		PrivateRoutes := BackGroup.Group("")
		{
			PrivateRoutes.
				Use(middleware.JWTAuth()).
				Use(middleware.FenFaSite()).
				Use(middleware.SiteCheck())
			// Use(middleware.ApiPower())
		}
		{
			JoinRoute := PrivateRoutes.Group("/join")
			{
				JoinRoute.POST("/list", controller_join.JoinController.List) //获取加盟列表
			}
			WechatRoute := PrivateRoutes.Group("/wechat")
			{
				{
					WechatRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
				}
				MenuRoute := WechatRoute.Group("/menu")
				{
					MenuRoute.POST("/add", wechat.WeChatController.CreateMenu) //创建自定义菜单
					MenuRoute.GET("/list", wechat.WeChatController.GetMenu)    //获取自定义菜单
				}
				SuCaiRoute := WechatRoute.Group("/sucai")
				{
					SuCaiRoute.POST("/list", wechat.WeChatController.GetSuCaiList)        //获取素材列表
					SuCaiRoute.POST("/draft", wechat.WeChatController.GetDraftList)       //获取素材列表
					SuCaiRoute.GET("/count", wechat.WeChatController.GetSuCaiCount)       //素材总数
					SuCaiRoute.GET("/draft_count", wechat.WeChatController.GetDraftCount) //素材总数

					SuCaiRoute.POST("/forever", wechat.WeChatController.GetForEver) //获取永久素材

				}
				AutoReplyRoute := WechatRoute.Group("/auto_reply")
				{
					SubscribeWhenReplyRoute := AutoReplyRoute.Group("/subscribe")
					{
						SubscribeWhenReplyRoute.POST("/update", wechat.WeChatController.SubscribeWhenReply) //关注时回复设置
						SubscribeWhenReplyRoute.GET("/info", wechat.WeChatController.GetSubscribeReply)     //获取回复
					}
				}
				TemplateRoute := WechatRoute.Group("/template")
				{
					TemplateRoute.GET("/list", wechat.WeChatController.GetTemplateList) //获取模板列表
				}
			}
			// 素材库端口
			CloudPanRoute := PrivateRoutes.Group("/cloud")
			{
				// CloudPanRoute.Use(middleware.NewRateLimiter(1000, 36000, 15*time.Minute))
				CloudDir := CloudPanRoute.Group("/dir")
				{
					CloudDir.GET("/list", dir.DirController.List)      //获取目录列表
					CloudDir.POST("/add", dir.DirController.Add)       //添加目录
					CloudDir.PUT("/edit", dir.DirController.Edit)      //添加目录
					CloudDir.POST("/delete", dir.DirController.Delete) //删除目录
				}
				CloudFile := CloudPanRoute.Group("/file")
				{
					CloudFile.GET("/list", file.FileController.List)                 //获取文件列表
					CloudFile.POST("/uuid", file.FileController.ReturnUUID)          //返回uuid
					CloudFile.POST("/upload", file.FileController.UploadFile)        //文件上传
					CloudFile.PUT("/edit", file.FileController.Edit)                 //修改文件
					CloudFile.POST("/delete", file.FileController.Delete)            //删除文件
					CloudFile.POST("/set_cover", file.FileController.UploadTempFile) //上传封面
				}
			}
			// // 经纪人端口
			// BrokerFrontRoute := PrivateRoutes.Group("/broker")
			// {
			// 	// 客户
			// 	BrokerClue := BrokerFrontRoute.Group("/user")
			// 	{
			// 		BrokerClue.GET("/common_list", broker.GetUserController.GetGlobalUser)   //获取公客池
			// 		BrokerClue.POST("/get_user", broker.GetUserController.GetUserToBroker)   //抢客户
			// 		BrokerClue.GET("/user_info", broker.GetUserController.GetGlobalUserInfo) //获取客户详情

			// 		// BrokerClue.GET("/private_list",broker.GetUserController.)

			// 	}
			// }
			// 运营端口
			OperateRoute := PrivateRoutes.Group("/operate")
			{
				{
					OperateRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
				}
				OperateRoute.GET("/list", operate.OperateController.List)
				OperateRoute.POST("/add", operate.OperateController.Add)
				OperateRoute.PUT("/edit", operate.OperateController.Edit)
				OperateRoute.POST("/delete", operate.OperateController.Delete)
				OperateRoute.PUT("/status", operate.OperateController.ChangeStatus)
			}
			// 系统管理
			SystemRoutes := PrivateRoutes.Group("/system")
			{
				IpRoute := SystemRoutes.Group("/ip")
				{
					IpRoute.POST("/list", admin_system.IpController.List)       //获取ip列表
					IpRoute.POST("/add", admin_system.IpController.AddIp)       //添加ip
					IpRoute.POST("/delete", admin_system.IpController.DeleteIp) //删除ip
				}
				ResourceRoute := SystemRoutes.Group("/resource")
				{
					ResourceRoute.GET("/list", controller.ApiController.GetApiList)
					ResourceRoute.POST("/add", controller.ApiController.Create)
					ResourceRoute.PUT("/edit", controller.ApiController.Edit)
					ResourceRoute.POST("/delete", controller.ApiController.Delete)
				}
				MessageRoute := SystemRoutes.Group("/message")
				{
					FeedRoute := MessageRoute.Group("/feedback")
					{
						FeedRoute.GET("/list", controller.FeedBackController.GetAccountFeedBackList)
						FeedRoute.POST("/add", controller.FeedBackController.CreateFeedAccountBack)
						FeedRoute.GET("/all_list", controller.FeedBackController.GetAllFeedBack)
						FeedRoute.POST("/status", controller.FeedBackController.OperaFeedback)
					}
				}
				UserRoute := SystemRoutes.Group("/user")
				{
					{
						UserRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}
					UserRoute.POST("/list", user.NewUserController.List) //获取客户
					UserRoute.GET("/info", user.NewUserController.Detail)
					UserRoute.POST("/shield", user.NewUserController.ShieldPhone) //屏蔽电话
				}
				CountrySettingRoute := SystemRoutes.Group("/country")
				{
					CountrySettingRoute.PUT("/edit", controller.CountrySettingController.Edit)
					CountrySettingRoute.GET("/info", controller.CountrySettingController.Info)
					CountrySettingRoute.PUT("/edit_assist", controller.CountrySettingController.EditAssist)
					CountrySettingRoute.PUT("/edit_private", controller.CountrySettingController.EditPrivate)
					CountrySettingRoute.GET("/get_assist", controller.CountrySettingController.GetAssist)
					CountrySettingRoute.GET("/get_private", controller.CountrySettingController.GetPrivate)

					OriginRoute := CountrySettingRoute.Group("/origin")
					{
						OriginRoute.GET("/list", controller.CountrySettingController.GetOriList)
						OriginRoute.POST("/add", controller.CountrySettingController.CreateOri)
						OriginRoute.PUT("/edit", controller.CountrySettingController.EditOri)
						OriginRoute.POST("/delete", controller.CountrySettingController.DeleteOri)
					}
				}
				EmojiRoute := CountrySettingRoute.Group("/emoji")
				{
					EmojiRoute.GET("/list", country_setting.EmojiController.List)
					EmojiRoute.POST("/add", country_setting.EmojiController.Add)
					EmojiRoute.PUT("/edit", country_setting.EmojiController.Edit)
					EmojiRoute.POST("/delete", country_setting.EmojiController.Delete)
				}
				FriendRoute := SystemRoutes.Group("/friendly")
				{
					FriendRoute.GET("/list", friendly_link.FriendlyLinkController.List)
					FriendRoute.POST("/add", friendly_link.FriendlyLinkController.Create)
					FriendRoute.PUT("/edit", friendly_link.FriendlyLinkController.Edit)
					FriendRoute.POST("/delete", friendly_link.FriendlyLinkController.Delete)

					FriendRoute.GET("/city_list", friendly_link.FriendlyLinkController.CityList)
					FriendRoute.POST("/add_link", friendly_link.FriendlyLinkController.CreateCityLink)
					FriendRoute.PUT("/edit_link", friendly_link.FriendlyLinkController.EditCityLink)
					FriendRoute.POST("/delete_link", friendly_link.FriendlyLinkController.DeleteCityLink)
					FriendRoute.GET("/get_city", friendly_link.FriendlyLinkController.GetCityList)
				}
				CommonPhraseRoute := SystemRoutes.Group("/common_phrase")
				{
					CommonPhraseCateRoute := CommonPhraseRoute.Group("/cate")
					{
						CommonPhraseCateRoute.GET("/list", common_phrase.CommonPhraseCateController.List)
						CommonPhraseCateRoute.POST("/add", common_phrase.CommonPhraseCateController.Add)
						CommonPhraseCateRoute.PUT("/edit", common_phrase.CommonPhraseCateController.Edit)
						CommonPhraseCateRoute.POST("/delete", common_phrase.CommonPhraseCateController.Delete)
					}
					CommonPhraseConRoute := CommonPhraseRoute.Group("/con")
					{
						CommonPhraseConRoute.GET("/list", common_phrase.CommonPhraseController.List)
						CommonPhraseConRoute.POST("/add", common_phrase.CommonPhraseController.Add)
						CommonPhraseConRoute.PUT("/edit", common_phrase.CommonPhraseController.Edit)
						CommonPhraseConRoute.POST("/delete", common_phrase.CommonPhraseController.Delete)
					}
				}
				MenuRoute := SystemRoutes.Group("/menu")
				{
					MenuRoute.POST("/add", controller.RouteController.AddRoute)        //添加路由
					MenuRoute.PUT("/edit", controller.RouteController.EditRoute)       //编辑路由
					MenuRoute.POST("/delete", controller.RouteController.DeleteRoutes) //删除路由
					MenuRoute.GET("/list", controller.RouteController.GetRoutes)       //获取路由列表
				}
				// PhoneRoute := SystemRoutes.Group("/phone")
				// {
				// 	PhoneRoute.POST("/add", controller.LouPanPhoneController.Create)
				// 	PhoneRoute.PUT("/edit", controller.LouPanPhoneController.Edit)
				// 	PhoneRoute.GET("/list", controller.LouPanPhoneController.List)
				// 	PhoneRoute.POST("/delete", controller.LouPanPhoneController.Delete)
				// }
				RoleRoute := SystemRoutes.Group("/role")
				{
					RoleRoute.GET("/list", controller.RoleController.GetRoleList) //获取角色列表

					RoleRoute.POST("/add", controller.RoleController.AddRole)  //添加角色
					RoleRoute.PUT("/edit", controller.RoleController.EditRole) //编辑角色

					// RoleRoute.POST("/change_menu", controller.RoleController.ChangeRoleRoutes) //更改菜单权限
					// RoleRoute.POST("/change_btn", controller.RoleController.ChangeRoleBtn)     //更改按钮权限
					RoleRoute.POST("/change_api", controller.RoleController.ChangeRoleApi) //更改api权限

					RoleRoute.POST("/power", controller.RoleController.ChangePower) //一次修改权限

				}
				AccountRoute := SystemRoutes.Group("/account")
				{
					{
						AccountRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}

					AccountRoute.POST("/send", account.AccountController.SendCode) //创建账号发送验证码

					AccountRoute.POST("/add", account.AccountController.AddAccount)          // 添加账户
					AccountRoute.PUT("/edit", account.AccountController.EditAccount)         // 编辑账户
					AccountRoute.POST("/delete", controller.AccountController.Delete)        //删除账户
					AccountRoute.PUT("/change_phone", account.AccountController.ChangePhone) // 改手机
					AccountRoute.PUT("/change_card", account.AccountController.ChangeIDCard) // 该身份证

					AccountRoute.GET("/info", controller.AccountController.GetAccountInfo)  //获取单个用户信息
					AccountRoute.POST("/list", controller.AccountController.GetAccountList) //获取用户列表

					AccountRoute.GET("/area", controller.AccountController.GetAreaByAccount)       //获取账号管理的地区
					AccountRoute.PUT("/set_region", controller.AccountController.SetAccountRegion) //

					AccountRoute.GET("/get_roles", controller.AccountController.GetRoleByAccount)         //根据账户获取子级角色
					AccountRoute.GET("get_region", controller.AccountController.GetCanSetRegionByAccount) //根据账户获取当前可以设置的地区

					AccountRoute.POST("/status", controller.AccountController.SetStatus) //设置状态

					AccountRoute.GET("/qr_code", account.AccountController.GenerateQRcode) //生成二维码

				}
				AboutUsRoute := SystemRoutes.Group("/about")
				{
					AboutCategoryRoute := AboutUsRoute.Group("/category")
					{
						AboutCategoryRoute.POST("/add", controller.AboutCategoryController.Create)
						AboutCategoryRoute.PUT("/edit", controller.AboutCategoryController.Edit)
						AboutCategoryRoute.GET("/list", controller.AboutCategoryController.List)
						AboutCategoryRoute.POST("/delete", controller.AboutCategoryController.Delete)
					}
					AboutSmallCategoryRoute := AboutUsRoute.Group("/small_category")
					{
						AboutSmallCategoryRoute.POST("/add", controller.AboutSmallCategoryController.Create)
						AboutSmallCategoryRoute.PUT("/edit", controller.AboutSmallCategoryController.Edit)
						AboutSmallCategoryRoute.GET("/list", controller.AboutSmallCategoryController.List)
						AboutSmallCategoryRoute.POST("/delete", controller.AboutSmallCategoryController.Delete)
					}
					AboutArticleRoute := AboutUsRoute.Group("/article")
					{
						AboutArticleRoute.POST("/add", controller.AboutArticleController.Create)
						AboutArticleRoute.PUT("/edit", controller.AboutArticleController.Edit)
						AboutArticleRoute.GET("/list", controller.AboutArticleController.List)
						AboutArticleRoute.GET("/info", controller.AboutArticleController.GetInfo)
						AboutArticleRoute.POST("/delete", controller.AboutArticleController.Delete)
					}

				}
				UploadRoute := SystemRoutes.Group("/upload")
				{
					{
						UploadRoute.Use(middleware.NewRateLimiter(1000, 3600000, 15*time.Minute))
					}
					UploadRoute.POST("/upload_file", controller.UploadController.UploadMultiFile) //上传文件
					UploadRoute.POST("/create_dir", controller.UploadController.CreateDir)        //创建文件夹
					UploadRoute.PUT("/edit_dir", controller.UploadController.EditDir)             //编辑文件夹
					UploadRoute.GET("/root", controller.UploadController.GetRoot)                 //获取用户素材库根目录
					UploadRoute.GET("/file_list", controller.UploadController.GetFiles)           //获取当前文件列表
					UploadRoute.GET("/get_single", controller.UploadController.GetSingleFile)     //获取单个文件信息
					UploadRoute.POST("/set_cover", controller.UploadController.UploadTempFile)    //下载临时文件

					UploadRoute.POST("/delete_file", controller.UploadController.Delete) //删除文件

				}
				RegionRoute := SystemRoutes.Group("/region")
				{
					RegionRoute.GET("/list", region.RegionController.GetRegionByAccount) // 根据用户获取地区
					RegionRoute.POST("/add", region.RegionController.AddRegion)          //添加地区
					RegionRoute.PUT("/edit", region.RegionController.EditRegion)         //编辑地区
					RegionRoute.POST("/delete", region.RegionController.Delete)          //删除地区
					RegionRoute.POST("/set_hot", region.RegionController.SetHot)
					RegionRoute.POST("/set_default", region.RegionController.SetDefault)

					RegionRoute.GET("/account_list", site.SiteController.GetCanSetRegionByAccount) //设置站长的列表
					RegionRoute.POST("/set_site", site.SiteController.SetSite)                     //设置站点
					RegionRoute.POST("/release_site", site.SiteController.ReleaseSite)             //解绑站点
					RegionRoute.GET("/site_list", site.SiteController.GetSiteList)                 //获取管理的站点
					RegionRoute.POST("/set_site_login", site.SiteController.SetNowSiteLogin)       //站点设置登录

					// 添加楼盘区域
					LouPanNameRoute := RegionRoute.Group("/loupan_name")
					{
						{
							LouPanNameRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
						}
						LouPanNameRoute.POST("/add", controller.LouPanNameController.Create)
						LouPanNameRoute.PUT("/edit", controller.LouPanNameController.Edit)
						LouPanNameRoute.POST("/delete", controller.LouPanNameController.Delete)
						LouPanNameRoute.GET("/list", controller.LouPanNameController.List)

						LouPanNameRoute.GET("/name_list", controller.LouPanNameController.ListByAccount) //楼盘名称
					}
				}
				ArticleRoute := SystemRoutes.Group("/article")
				{
					{
						ArticleRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}
					ArticleRoute.POST("/group/add", controller.ArticleController.CreateGroup)    //创建分组
					ArticleRoute.PUT("/group/edit", controller.ArticleController.EditGroup)      //编辑分组
					ArticleRoute.POST("/group/delete", controller.ArticleController.DeleteGroup) //删除分组
					ArticleRoute.GET("/group/list", controller.ArticleController.GetGroupList)   //获取分组列表

					ArticleRoute.POST("/add", controller.ArticleController.CreateArticle)   //创建文章
					ArticleRoute.PUT("/edit", controller.ArticleController.EditArticle)     //编辑文章
					ArticleRoute.POST("/delete", controller.ArticleController.Delete)       //删除文章
					ArticleRoute.POST("/list", controller.ArticleController.GetList)        //获取文章列表
					ArticleRoute.GET("/detail", controller.ArticleController.SearchArticle) //获取单个文章
				}
				LouPanRoute := SystemRoutes.Group("/loupan")
				{
					{
						LouPanRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}
					LouPanRoute.POST("/list", loupan.LouPanController.GetLouPanList)                            //获取楼盘列表
					LouPanRoute.POST("/add", loupan.LouPanController.CreateLouPan)                              //新增楼盘
					LouPanRoute.PUT("/edit", loupan.LouPanController.EditLouPan)                                //编辑楼盘
					LouPanRoute.POST("/delete", loupan.LouPanController.Delete)                                 //删除楼盘
					LouPanRoute.GET("/info", loupan.LouPanController.GetLouPanInfo)                             //获取单个楼盘的信息
					LouPanRoute.GET("/get_garrison", loupan.LouPanController.GetGarrison)                       //获取驻守人员
					LouPanRoute.POST("/release_broker", loupan.LouPanController.ReleaseBroker)                  //释放经纪人
					LouPanRoute.POST("/add_broker", loupan.LouPanController.AddBrokerToLouPan)                  //添加经纪人
					LouPanRoute.GET("/can_garrison", loupan.LouPanController.FindBrokerNotGarrisonInThisLouPan) //获取可驻守的人员
					LouPanRoute.GET("/phone_400", loupan.LouPanController.Phone400List)
					LouPanRoute.POST("/phone_add", loupan.LouPanController.AddPhoneForLou)     //获取该楼盘的语音审核
					LouPanRoute.POST("/phone_await", loupan.LouPanController.UpdateAudioPhone) //同步
					PlatFormRoute := LouPanRoute.Group("/platform")
					{
						PlatFormRoute.GET("/list", loupan.PlatFormController.List) //平台列表
						PlatFormRoute.POST("/add", loupan.PlatFormController.Add)
						PlatFormRoute.PUT("/edit", loupan.PlatFormController.Edit)
						PlatFormRoute.POST("/delete", loupan.PlatFormController.Delete)
					}
					WhatsAppRoute := LouPanRoute.Group("/whatsapp")
					{
						WhatsAppRoute.POST("/set_whats_app", loupan.WhatsAppController.SetApp) //设置whatsapp
					}
					PriceRoute := LouPanRoute.Group("/price")
					{
						PriceRoute.GET("/list", controller.PriceController.List)
						PriceRoute.POST("/add", controller.PriceController.Create)
						PriceRoute.PUT("/edit", controller.PriceController.Edit)
						PriceRoute.POST("/delete", controller.PriceController.Delete)
					}
					TotalPriceRoute := LouPanRoute.Group("/total_price")
					{
						TotalPriceRoute.GET("/list", controller.TotalPriceController.List)
						TotalPriceRoute.POST("/add", controller.TotalPriceController.Create)
						TotalPriceRoute.PUT("/edit", controller.TotalPriceController.Edit)
						TotalPriceRoute.DELETE("/delete", controller.TotalPriceController.Delete)
					}
					TeSeRoute := LouPanRoute.Group("/tese")
					{
						TeSeRoute.GET("/list", controller.LouPanTeSeController.List)
						TeSeRoute.POST("/add", controller.LouPanTeSeController.Create)
						TeSeRoute.PUT("/edit", controller.LouPanTeSeController.Update)
						TeSeRoute.POST("/delete", controller.LouPanTeSeController.Delete)
					}

					SellStatusRoute := LouPanRoute.Group("/sell")
					{
						SellStatusRoute.GET("/list", controller.SellStatusController.GetStatusList) //获取状态列表
						SellStatusRoute.POST("/add", controller.SellStatusController.CreateStatus)  //创建销售状态
						SellStatusRoute.PUT("/edit", controller.SellStatusController.EditStatus)    //编辑销售状态
						SellStatusRoute.POST("/delete", controller.SellStatusController.Delete)     //删除销售状态
					}
					PropertyRoute := LouPanRoute.Group("/property")
					{
						PropertyRoute.GET("/list", controller.PropertyController.GetPropertyList)
						PropertyRoute.POST("/add", controller.PropertyController.CreateProperty)
						PropertyRoute.PUT("/edit", controller.PropertyController.EditProperty)
						PropertyRoute.POST("/delete", controller.PropertyController.Delete)
					}
					TagRoute := LouPanRoute.Group("/tag")
					{
						TagRoute.GET("/list", controller.TagController.GetTagList)
						TagRoute.POST("/add", controller.TagController.CreateTag)
						TagRoute.PUT("/edit", controller.TagController.EditTag)
					}
					RoomRoute := LouPanRoute.Group("/room_type")
					{
						RoomRoute.GET("/list", controller.RoomController.GetRoomList)
						RoomRoute.POST("/add", controller.RoomController.CreateRoom)
						RoomRoute.PUT("/edit", controller.RoomController.EditRoom)
						RoomRoute.POST("/delete", controller.RoomController.Delete)
					}
					DisRoute := LouPanRoute.Group("/dis")
					{
						DisRoute.GET("/list", controller.DisadvantageController.GetDisadvantageList)
						DisRoute.POST("/add", controller.DisadvantageController.CreateDisadvantage)
						DisRoute.PUT("/edit", controller.DisadvantageController.EditDisadvantage)
						// DisRoute.GET("/region")
						DisRoute.POST("/delete", controller.DisadvantageController.Delete)
					}
					SwiperCategoryRoute := LouPanRoute.Group("/category")
					{
						SwiperCategoryRoute.GET("/list", controller.SwiperCategoryController.GetCategoryList) //获取轮播图分类
						SwiperCategoryRoute.POST("/add", controller.SwiperCategoryController.CreateCategory)  //创建分类
						SwiperCategoryRoute.PUT("/edit", controller.SwiperCategoryController.EditCategory)    //编辑分类

					}
					SwiperRoute := LouPanRoute.Group("/swiper")
					{
						SwiperRoute.GET("/list", controller.LouPanSwiperController.GetLouPanSwiperList) //获取相册
						SwiperRoute.POST("/add", controller.LouPanSwiperController.CreateSwiper)        //添加相册
						SwiperRoute.PUT("/edit", controller.LouPanSwiperController.EditSwiper)          //编辑相册
						SwiperRoute.POST("/delete", controller.LouPanSwiperController.Delete)           //删除相册
					}
					RoomInfoRoute := LouPanRoute.Group("/room")
					{
						RoomInfoRoute.GET("/list", controller.RoomInfoController.GetRoomList) //获取户型列表
						RoomInfoRoute.POST("/add", controller.RoomInfoController.CreateRoom)  //创建户型
						RoomInfoRoute.PUT("/edit", controller.RoomInfoController.EditRoom)    //编辑户型
						RoomInfoRoute.GET("/info", controller.RoomInfoController.GetRoomInfo) //获取单个户型信息
					}
					RoomSwiperRoute := LouPanRoute.Group("/room_swiper")
					{
						RoomSwiperRoute.GET("/list", controller.RoomSwiperController.GetRoomSwiperList) //获取户型相册
						RoomSwiperRoute.POST("/add", controller.RoomSwiperController.CreateSwiper)      //添加户型相册
						RoomSwiperRoute.PUT("/edit", controller.RoomSwiperController.EditSwiper)        //编辑户型相册
						RoomSwiperRoute.POST("/delete", controller.RoomSwiperController.DeleteSwiper)   //删除户型相册
					}
					ActiveRoute := LouPanRoute.Group("/active")
					{
						ActiveRoute.POST("/group/add", controller.ActiveController.CreateGroup)  //创建分组
						ActiveRoute.PUT("/group/edit", controller.ActiveController.EditGroup)    //编辑分组
						ActiveRoute.GET("/group/list", controller.ActiveController.GetGroupList) //获取分组列表

						ActiveRoute.POST("/add", controller.ActiveController.CreateActive)   //创建动态
						ActiveRoute.PUT("/edit", controller.ActiveController.EditActive)     //编辑动态
						ActiveRoute.POST("/delete", controller.ActiveController.Delete)      //删除动态
						ActiveRoute.POST("/list", controller.ActiveController.GetList)       //获取动态列表
						ActiveRoute.GET("/detail", controller.ActiveController.SearchActive) //获取单个文章
					}
					ActivityRoute := LouPanRoute.Group("/activity")
					{
						ActivityRoute.GET("/list", controller.ActivityController.GetActivityList) //获取活动列表
						ActivityRoute.POST("/add", controller.ActivityController.CreateActivity)  //创建活动
						ActivityRoute.PUT("/edit", controller.ActivityController.EditActivity)    //编辑活动
					}
					ModelActivityRoute := LouPanRoute.Group("/model_activity")
					{
						ModelActivityRoute.GET("/list", controller.ModelActivityController.GetModelActivityList)                //获取活动列表
						ModelActivityRoute.GET("/all", controller.ModelActivityController.GetAllModel)                          //获取所有的列表
						ModelActivityRoute.POST("/add", controller.ModelActivityController.CreateModelActivity)                 //创建活动
						ModelActivityRoute.PUT("/edit", controller.ModelActivityController.EditModelActivity)                   //编辑活动
						ModelActivityRoute.GET("/region", controller.ModelActivityController.GetRegion)                         //获取城市
						ModelActivityRoute.GET("/get_model_by_loupan", controller.ModelActivityController.GetModelActivityList) //根据所在城市获取模板
					}
					CommonActivityRoute := LouPanRoute.Group("/common_activity")
					{
						CommonActivityRoute.GET("/list", controller.CommonActivityController.GetActivityList)
						CommonActivityRoute.POST("/add", controller.CommonActivityController.CreateActivity)
						CommonActivityRoute.PUT("/edit", controller.CommonActivityController.EditActivity)
						CommonActivityRoute.POST("/delete", controller.CommonActivityController.Delete) //删除
					}
					AreaRoute := LouPanRoute.Group("/area")
					{
						AreaRoute.GET("/list", controller.AreaController.GetAreaList)
						AreaRoute.POST("/add", controller.AreaController.CreateArea)
						AreaRoute.PUT("/edit", controller.AreaController.EditArea)
						AreaRoute.POST("/delete", controller.AreaController.Delete)
					}

				}
				BrokerRoute := SystemRoutes.Group("/broker")
				{
					{
						BrokerRoute.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}
					BrokerRoute.GET("/list", broker.BrokerController.GetBrokerList) //获取楼盘经纪人列表
					BrokerRoute.POST("/add", broker.BrokerController.CreateBroker)  //添加楼盘经纪人
					BrokerRoute.PUT("/edit", broker.BrokerController.EditBroker)
					// BrokerRoute.POST("/loupan", controller.BrokerController.ReplaceLouPan)
					BrokerRoute.GET("/lous", broker.BrokerController.GetAllLouPan)
					BrokerRoute.POST("/delete", broker.BrokerController.Delete)
					BrokerRoute.PUT("/status", broker.BrokerController.Status)
					BrokerRoute.POST("/gold", broker.BrokerController.SendGold)
				}
				LouPanHelp := SystemRoutes.Group("/lou_pan_help")
				{
					LouPanHelp.GET("/list", controller.BrokerHelpController.GetLouPanList)
					LouPanHelp.GET("/info", controller.BrokerHelpController.GetLouPanInfo)

					BrokerActiveRoute := LouPanHelp.Group("/active")
					{
						BrokerActiveRoute.GET("/list", controller.HelpActiveController.GetActiveList)
						BrokerActiveRoute.GET("/info", controller.HelpActiveController.GetActive)
					}
				}
				MapRoute := SystemRoutes.Group("/map")
				{
					MapRoute.GET("/tips", controller.MapController.SearchTips) //输入提示
					MapRoute.GET("/city", controller.MapController.GetCity)
				}
				ShopRoute := SystemRoutes.Group("/shop")
				{
					ParamsRoute := ShopRoute.Group("/params")
					{
						ParamsRoute.GET("/list", controller.ParamsController.GetParams)
						ParamsRoute.POST("/add", controller.ParamsController.CreateParams)
					}
					WebRoute := ShopRoute.Group("/route")
					{
						WebRoute.GET("/list", controller.ShopRouteController.GetShopRouteList)
						WebRoute.POST("/add", controller.ShopRouteController.CreateShopRoute)
						WebRoute.PUT("/edit", controller.ShopRouteController.EditShopRoute)
						WebRoute.POST("/delete", controller.ShopRouteController.Delete)
					}
					SwiperRoute := ShopRoute.Group("/swiper")
					{
						SwiperRoute.GET("/article", controller.HomeSwiperController.GetArticleList)
						SwiperRoute.GET("/list", controller.HomeSwiperController.GetSwiperList)
						SwiperRoute.POST("/add", controller.HomeSwiperController.CreateSwiper)
						SwiperRoute.POST("/delete", controller.HomeSwiperController.Delete)
						// pc端
						PCSwiperRoute := SwiperRoute.Group("/pc")
						{
							PCSwiperRoute.POST("/add", home_swiper.HomeSwiperController.AddSwiper) //添加pc端轮播图
							PCSwiperRoute.GET("/list", home_swiper.HomeSwiperController.List)      //获取pc端轮播图
						}
					}
				}
				CitySettingGroup := SystemRoutes.Group("/city_setting")
				{
					{
						CitySettingGroup.Use(middleware.NewRateLimiter(100, 3600, 15*time.Minute))
					}
					CitySettingGroup.GET("/region", controller.CitySettingController.GetManageCities)
					CitySettingGroup.GET("/config", controller.CitySettingController.GetCityConfig)
					CitySettingGroup.PUT("/edit", controller.CitySettingController.EditCityConfig)
				}
				// AuditGroup := SystemRoutes.Group("/audit")
				// {
				// 	AuditAccountRoute := AuditGroup.Group("/account")
				// 	{
				// 		AuditAccountRoute.GET("/list", controller.AuditController.GetAccountAuditList)                 //获取账号审核列表
				// 		AuditAccountRoute.POST("/audit", controller.AuditController.OperaAccountAudit)                 //审核
				// 		AuditAccountRoute.GET("/account_single", controller.AuditController.GetSingleAccountAuditInfo) //获取单条账号审核记录
				// 	}
				// }
			}
			// BackEnter := PrivateRoutes.Group("/safe") //安全切换模式
			// {
			// 	BackEnter.GET("/enter", controller.BackEnterController.EnterChildAccount) //安全登录子以及其从属账号
			// }
		}

	}

	// 运行

	runPort := fmt.Sprintf(":%s", global.OC_CONFIG.System.Host)

	fmt.Printf("服务器运行端口:%s \n", fmt.Sprintf("%s%s", global.OC_CONFIG.System.Addr, runPort))

	Router.Run(runPort)
}
